import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
};

const routes = [
  {
    path: '/',
    redirect: 'login'
  },
  {
    path:"/login",
    component:()=>import('@/views/HomeView.vue')
  },
  {
    path:"/food",
    component:()=>import('@/views/Food.vue')
  },
  {
    path:"/jb",
    component:()=>import('@/views/Jb.vue')
  },
  {
    path:"/motion",
    component:()=>import('@/views/Motion.vue')
  },
  {
    path:"/che",
    component:()=>import('@/views/Che.vue')
  },
  {
    path:"/meal",
    component:()=>import('@/views/Meal.vue')
  },
  {
    path:"/date",
    component:()=>import('@/views/AppointmentSettings.vue')
  },
  {
    path:"/make",
    component:()=>import('@/views/Make.vue')
  },
  {
    path:"/enroll",
    component:()=>import('@/views/Enroll.vue')
  },
  {
    path:"/hytj",
    component:()=>import('@/views/hytj.vue')
  },
  {
    path: '/index',
    component: () => import('@/views/Userviwe.vue'),
    children:[
      {path:"archives",component: ()=>import('@/views/ss.vue')},
      {path:"phy",component:()=>import('@/views/Physicall.vue')},
      {path:"users",component:()=>import('@/views/users.vue')},
        {path:"food",component:()=>import('@/views/Food.vue')},
        {path:"motion",component:()=>import('@/views/Motion.vue')},
        {path:"jb",component:()=>import('@/views/Jb.vue')},
        {path:"che",component:()=>import('@/views/Che.vue')},
        {path:"meal",component:()=>import('@/views/Meal.vue')},
        {path:"date",component:()=>import('@/views/AppointmentSettings.vue')},
        {path:"make",component:()=>import('@/views/Make.vue')},
        {path:"make",component:()=>import('@/views/Make.vue')},
        {path:"hytj",component:()=>import('@/views/hytj.vue')},
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
